package com.xinyi;

import java.util.Arrays;

/**
 * @desc:
 * @author: Shoko
 * @date: 2025/4/22
 */
public class AdapterPatternDemo {
    public static void main(String[] args) {
        // 使用适配器
        DataOperation operation = new OperationAdapter();
        int[] arr = {5, 3, 9, 1, 7};

        // 测试排序
        System.out.println("排序前：" + Arrays.toString(arr));
        operation.Sort(arr);
        System.out.println("排序后：" + Arrays.toString(arr));

        // 测试查找
        int target = 7;
        int index = operation.Search(arr, target);
        System.out.println("查找" + target + "的索引：" + index);
    }
}
